<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\cms\model;

use plugin\saiadmin\basic\BaseModel;

/**
 * 讲者护照表模型
 */
class SpeakerPassport extends BaseModel
{

    /**
     * 数据表主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 数据库表名称
     * @var string
     */
    protected $table = 'eb_speaker_passport';

    // protected $type = [
    //     'upload_passport'      =>  'array',

    // ];
    /**
     * 姓 搜索
     */
    public function searchSurnameAttr($query, $value)
    {
        $query->where('surname', 'like', '%' . $value . '%');
    }

    /**
     * 名 搜索
     */
    public function searchNameAttr($query, $value)
    {
        $query->where('name', 'like', '%' . $value . '%');
    }


    /**
     * 关联模型speaker
     */
    public function speaker()
    {
        return $this->belongsTo(Speaker::class, 'speaker_id', 'id');
    }
}
